package com.mingtu.guards.activity;

import com.blankj.utilcode.util.StringUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.mingtu.common.base.BaseActivity;
import com.mingtu.guards.R;
import com.tencent.smtt.sdk.WebSettings;
import com.tencent.smtt.sdk.WebView;

import butterknife.BindView;

public class TbsWebActivity extends BaseActivity {

    @BindView(R.id.web_view)
    WebView webView;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_tbs_web;
    }

    @Override
    protected void initView() {
        String url = getIntent().getStringExtra("url");
        String title = getIntent().getStringExtra("title");

        if (!StringUtils.isEmpty(title)) {
            setModuleTitle(title);
        }


        if (!StringUtils.isEmpty(url)) {
            WebSettings webSettings = webView.getSettings();
            webSettings.setDisplayZoomControls(false); //隐藏webview缩放按钮
            webSettings.setJavaScriptEnabled(true);//支持js
//        webSettings.setBuiltInZoomControls(true); // 显示放大缩小
//        webSettings.setSupportZoom(true); // 可以缩放
            webSettings.setAppCacheEnabled(false);
            webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
            webSettings.setDomStorageEnabled(true);
//            适配屏幕
            webSettings.setUseWideViewPort(true);
            webSettings.setLoadWithOverviewMode(true);
            webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
            webSettings.setTextZoom(100);
            webSettings.setStandardFontFamily("family");
            webView.loadUrl(url);
        } else {
            ToastUtils.showLong("链接地址无效哦！");
        }
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void getData() {

    }


}